package top.fzqblog.firstapp;

import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.view.ViewPager;

import java.util.Arrays;

import butterknife.BindView;
import butterknife.ButterKnife;
import top.fzqblog.adapter.ImageViewAdapter;
import top.fzqblog.pagetransformer.AlaphaTransformer;

/**
 * Created by 抽离 on 2017/9/17 0017.
 */

public class ImageViewPagerTest extends Activity {

    @BindView(R.id.imageViewPager)
    ViewPager imageViewPager;

    private Integer[] images = {R.mipmap.bg1, R.mipmap.bg2, R.mipmap.bg3,
            R.mipmap.bg4, R.mipmap.bg5, R.mipmap.bg6, R.mipmap.bg7, R.mipmap.bg8};


    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.image_view_pager);
        ButterKnife.bind(this);
        imageViewPager.setPageMargin(30);//两张图片之间的距离
        imageViewPager.setOffscreenPageLimit(3);//一个view中显示3张图
        imageViewPager.setPageTransformer(false,  new AlaphaTransformer());
        imageViewPager.setAdapter(new ImageViewAdapter(Arrays.asList(images), this));
    }


}
